def process_line(s: str):
    parts = s.split('5')
    nums = []
    for p in parts:
        if p == "":
            continue
        nums.append(int(p))
    nums.sort()
    return " ".join(str(x) for x in nums)
def main():
    while True:
        s = input("请输入一行数字：").strip()
        if s == "":
            print("程序结束。")
            break
        ans = process_line(s)
        print("结果：", ans)


if __name__ == "__main__":
    main()
